package silence.demo7.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import silence.demo7.bean.BaseRespVo;
import silence.demo7.bean.DhyUser;
import silence.demo7.mapper.UserMapper;

/**
 * @author: Silence_W
 * @date: 2021-01-07 23:30
 **/

@RestController
public class UserController {
    @Autowired
    UserMapper userMapper;

    @RequestMapping("query/{id}")
    public BaseRespVo query(@PathVariable("id") Integer id){
        String s = userMapper.selectUsernameById(id);
        return  BaseRespVo.ok(s);
    }

    @RequestMapping("dhy/{id}")
    public BaseRespVo queryUserNameById(@PathVariable("id")Integer id){
       DhyUser user= userMapper.selectUserById(id);
       return BaseRespVo.ok(user);
    }
    //lichao
    @RequestMapping("lichao/{id}")
    public BaseRespVo showMessage(@PathVariable("id")Integer id){
        String username = userMapper.selectUserById1(id);
        return  BaseRespVo.ok(username);
    }

    // zql
    @RequestMapping("query/address/{id}")
    public BaseRespVo queryAddress(@PathVariable("id") Integer id){
        String s = userMapper.selectAddressById(id);
        System.out.println("he");
        return  BaseRespVo.ok(s);
    }

    @RequestMapping("queryName/{ids}")
    public BaseRespVo queryUserName(@PathVariable("ids") Integer ids){
        String name = userMapper.selectUserNameById(ids);
        return BaseRespVo.ok(name);
    }

}
